package com.coffee.system.entity;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.*;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.coffee.common.annotation.ExcelDict;
import com.coffee.common.convert.ExcelDictConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 系统参数
 * </p>
 *
 * @author Kevin
 * @since 2021-06-10
 */
@Data
@ColumnWidth(15)
@HeadRowHeight(15)
@ContentRowHeight(15)
@HeadStyle
@HeadFontStyle(fontHeightInPoints = 12)
@ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER)
@ContentFontStyle(fontHeightInPoints = 10)
@ExcelIgnoreUnannotated
public class SysConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 参数名称
     */
    @ExcelProperty(value = "参数名称", index = 0)
    private String configName;

    /**
     * 参数键名
     */
    @ExcelProperty(value = "参数键名", index = 1)
    private String configKey;

    /**
     * 参数键值
     */
    @ExcelProperty(value = "参数键值", index = 2)
    private String configValue;

    /**
     * 备注
     */
    @ExcelProperty(value = "备注", index = 4)
    private String remarks;

    /**
     * 状态 0正常；1停用
     */
    @ExcelProperty(value = "状态", index = 3, converter = ExcelDictConverter.class)
    @ExcelDict("sys_status")
    private String status;

    /**
     * 创建人
     */
    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @ColumnWidth(20)
    @ExcelProperty(value = "创建时间", index = 5)
    private Date createTime;

    /**
     * 更新人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @ColumnWidth(20)
    @ExcelProperty(value = "更新时间", index = 6)
    private Date updateTime;


}